<template>
    <h2>用户理财项目列表</h2>
    项目名称:<input type="text" v-model="I_Name">
    总金额:<input type="text" v-model="I_Mon_1"> -<input type="text" v-model="I_Mon_2">
    <input type="button" value="查询" @click="Show">
    <table>
        <thead>
            <tr>
                <td>项目编号</td>
                <td>项目名称</td>
                <td>理财总金额</td>
                <td>最低金额</td>
                <td>理财人数</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>

            <tr v-for="item in data" :key="item.I_Id">
                <td>{{ item.I_Id }}</td>
                <td>{{ item.I_Name }}</td>
                <td>{{ item.I_Mon }}</td>
                <td>{{ item.I_Min }}</td>
                <td>{{ item.I_Num }}</td>
                <td><input type="button" value="我要赎回" @click="SH(item.I_Id)"></td>
            </tr>
        </tbody>
    </table>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import axios from 'axios';
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
const data = ref([{
    I_Id: '',
    I_Name: '',
    I_Mon: '',
    I_Min: '',
    I_Num: '',

}])
onMounted(() => {
    Show()
})
const I_Name = ref('');
const I_Mon_1 = ref('');
const I_Mon_2 = ref('');
const Show = () => {
    axios.get('http://localhost:25825/api/Demo/Show?I_Name=' + I_Name.value, {
        params: {
            I_Name: I_Name.value,
            I_Mon_1: I_Mon_1.value,
            I_Mon_2: I_Mon_2.value
        }
    })
        .then(res => {
            data.value = res.data
        })
}
const router = useRouter();
const SH = (I_Id: number) => {
    router.push({
        name: 'Manager',
        params: {
            I_Id: I_Id
        }
    })
}
</script>